UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WLmCk1nK3v+Vg7Y2wrYep9073n95fJr+UkDlFlCMbE0=' 
WHERE 
  key_id = 'ba804af4b05733563e0cf5623439026227e67f0deead2c2ecf2e5e840e0f5341' 
  AND (
    token = 'WLmCk1nK3v+Vg7Y2wrYep9073n95fJr+UkDlFlCMbE0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039