UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R28Sr83IuAOBKHJ+eFpbOo/KzEoauJTSuKO/mnmi404=' 
WHERE 
  key_id = '9ed4c1429f73e7f6d66409daec141dd89bbc81a02b815a57665094235e2174be' 
  AND (
    token = 'R28Sr83IuAOBKHJ+eFpbOo/KzEoauJTSuKO/mnmi404=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044