UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hhRB7VvJe0T5krugdIIWoyRcPKqNvRK1/DZBXJ3zk+E=' 
WHERE 
  key_id = '18b7c474f073ad45cd800e7a35f6c7da0e271594514d17e90687f6161a17c101' 
  AND (
    token = 'hhRB7VvJe0T5krugdIIWoyRcPKqNvRK1/DZBXJ3zk+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018