UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5YrL/umJ7NAbDMX1myD+y+xZ58HYiv1nIYvzQtduq+E=' 
WHERE 
  key_id = '2cba663b6fa574d871669edb20a071b3f5cb135add63ffb7267f1b6451f21e47' 
  AND (
    token = '5YrL/umJ7NAbDMX1myD+y+xZ58HYiv1nIYvzQtduq+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026