UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hDTi4dJrXrkeFVzaQXJkCkNcI2DZqDyGVAsCmMq5Yho=' 
WHERE 
  key_id = '9477700727a3a53e04efbeb92927f4f07811051fd0963ce00bc72a8f7f84890f' 
  AND (
    token = 'hDTi4dJrXrkeFVzaQXJkCkNcI2DZqDyGVAsCmMq5Yho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065