UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'apv8o/wQJQFY+yWJJBssK8LkHjoMYnZ+6hZacQgD00A=' 
WHERE 
  key_id = '9f704a754d8816b2e5c9e9590aa954fb40b89e2550d31af53650e3635b1585a4' 
  AND (
    token = 'apv8o/wQJQFY+yWJJBssK8LkHjoMYnZ+6hZacQgD00A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041