UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UYnFO535ndQyQbAn+XZyjZOTtNsAtEDcsmDz06wk8rw=' 
WHERE 
  key_id = '61d077f098ae504f041d136d5c92df5c87c87d299fa87970aedac20244acc137' 
  AND (
    token = 'UYnFO535ndQyQbAn+XZyjZOTtNsAtEDcsmDz06wk8rw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032