UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5vGnAfjuDSduYaeWDd3GzAdqC9/Aib/GaYY5oa/Yn90=' 
WHERE 
  key_id = '74e147bf639d5eddd548384ecdd18d62893d34ddae305273e3d77e4456e89f9b' 
  AND (
    token = '5vGnAfjuDSduYaeWDd3GzAdqC9/Aib/GaYY5oa/Yn90=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039