UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l2yIc6+37vGOxhO9UMsOaMdO8xiFq0X7rqrmnWJx9gI=' 
WHERE 
  key_id = '2815bc83fc4ae89807348995988e4da359dee1c92ac064e7cb7cb17022dfa501' 
  AND (
    token = 'l2yIc6+37vGOxhO9UMsOaMdO8xiFq0X7rqrmnWJx9gI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034