UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lqAAu7R1S2FrbGWnf+d3pzlCDQrFbkxsebUvsPuQR5o=' 
WHERE 
  key_id = 'e0b86429f738051bd35bad5606b07383c131899dbc12f095609c9823a9d73085' 
  AND (
    token = 'lqAAu7R1S2FrbGWnf+d3pzlCDQrFbkxsebUvsPuQR5o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037