UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RYxUd6pklZaNj3vWRDsys+mA/LIreBn6DuWIxQHv9+M=' 
WHERE 
  key_id = '394fa703254fa2c8a9b6c62af797f6a50c3bf9f273aba30a221c5bffd288b10f' 
  AND (
    token = 'RYxUd6pklZaNj3vWRDsys+mA/LIreBn6DuWIxQHv9+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038