UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xPekeuVg7vs85vonlxH71Oz0GPPfSpOHN6fxHb+/qiA=' 
WHERE 
  key_id = '691caab97a47bf3b4265a3d86c968f89cc7c47edfbc2f50c18de9fee1946b009' 
  AND (
    token = 'xPekeuVg7vs85vonlxH71Oz0GPPfSpOHN6fxHb+/qiA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047