UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r3405iQAWFYuX1dT6HEBobKfHmonRfc3JFVUR59xcAA=' 
WHERE 
  key_id = 'e3d3396b9e84d9df67fc5f0992c01a92231b4cef2832ec2a88b5b4de5cc47e87' 
  AND (
    token = 'r3405iQAWFYuX1dT6HEBobKfHmonRfc3JFVUR59xcAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048