UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pGewWmDSAgr3LdgmGeB2HtOPz94DJ/4Xpumjig43+ZM=' 
WHERE 
  key_id = '638e5586732ce5592523e1b278a1443c2258f6bf6aeb74e8e0b64572150f478c' 
  AND (
    token = 'pGewWmDSAgr3LdgmGeB2HtOPz94DJ/4Xpumjig43+ZM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027