UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hwwm5+a1x4bGyfcdpsHJTFk0LhpR3g24wVIzhS3pp2g=' 
WHERE 
  key_id = '5285de694f67024c58819621641d2110e561bc947668f5f32e3338cc34769885' 
  AND (
    token = 'hwwm5+a1x4bGyfcdpsHJTFk0LhpR3g24wVIzhS3pp2g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050