UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lq6FrxpussXg6EddGwREPb4ESTWFHIw8cUj/nIYBmw8=' 
WHERE 
  key_id = '1262aade946a4623540e552436027dd175f5e390c1b314bcbcac19a6c3d714cd' 
  AND (
    token = 'lq6FrxpussXg6EddGwREPb4ESTWFHIw8cUj/nIYBmw8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043