UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lsj3XkcY20F+BIpdBNw49UEOGuYsaBZ2bq7+q9r4VuY=' 
WHERE 
  key_id = '62d986be6cab59625ce45d8737599dd051131123f01ff5f44d20ba2757b51e9a' 
  AND (
    token = 'lsj3XkcY20F+BIpdBNw49UEOGuYsaBZ2bq7+q9r4VuY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034