UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cOmR0JE/zKPgjtVAuXcO/H+k9MWvrzzTc6aGlgRxCEs=' 
WHERE 
  key_id = '7f92182af02af87a4294a9518efb177eb4e8506588907588494bbd43286627ff' 
  AND (
    token = 'cOmR0JE/zKPgjtVAuXcO/H+k9MWvrzzTc6aGlgRxCEs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056