UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xGpi3x+vCyLnH39/rrjINdJCc7cbplsTzP7Rvzws1wU=' 
WHERE 
  key_id = '9f0d5f8dc81e9511976e14c056176f9b1d5400b3351f131b5d0da9f9f5eab7e6' 
  AND (
    token = 'xGpi3x+vCyLnH39/rrjINdJCc7cbplsTzP7Rvzws1wU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047