UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G0wVNoP9g9mYNLF02MroOhZlSaWU2ZHQAToi4/knJmA=' 
WHERE 
  key_id = '536ef3a082864e857f70b7efca05a04b9a7a60d877d3d257a21193e3a7b88949' 
  AND (
    token = 'G0wVNoP9g9mYNLF02MroOhZlSaWU2ZHQAToi4/knJmA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021