UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ck9flcxKLfCn38dPyB8vt1Hl5/LP3m0PkTHoFr+OtAI=' 
WHERE 
  key_id = '8fb90483fce35095b4b0c5524e1e8fb320b63484b828384752bca505d1587136' 
  AND (
    token = 'ck9flcxKLfCn38dPyB8vt1Hl5/LP3m0PkTHoFr+OtAI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034