UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HG9e86RlhM/dspIqOnpCFVt8aY4rnNHlibswpEtGq24=' 
WHERE 
  key_id = '37e221a2752afef64449bd00af11e58e1a463b604cf854ee28d9067db136ed75' 
  AND (
    token = 'HG9e86RlhM/dspIqOnpCFVt8aY4rnNHlibswpEtGq24=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044