UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R8sL3oT5pSBcznlOZPMpW0vhn8CMHBdEqo3z7UZAwpY=' 
WHERE 
  key_id = 'b05266886af5d253028df3fca31a331f4f46e22143a8480f9ad9339dca50b886' 
  AND (
    token = 'R8sL3oT5pSBcznlOZPMpW0vhn8CMHBdEqo3z7UZAwpY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039