UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DsOvDYz3+xVioxVhjYoyYZFQRVWv70DogGoHcrak9Hw=' 
WHERE 
  key_id = '1900b2251bc6ececf823ea72bfe48e58c78f144617a29b41be93f8deddcf2cde' 
  AND (
    token = 'DsOvDYz3+xVioxVhjYoyYZFQRVWv70DogGoHcrak9Hw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019