UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd8+QmJtpKIPzvyahyk1A74smrmE4SKLEPAG2v04PnPo=' 
WHERE 
  key_id = '59b0c5d81f0905ca2c963dd7a3e2a06856da89c2293483e8f360379d251a7d7f' 
  AND (
    token = 'd8+QmJtpKIPzvyahyk1A74smrmE4SKLEPAG2v04PnPo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028