UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BkgxyZaKQEmymPApIgkdzOxCN6Jtln7HqMZ11zx+C6k=' 
WHERE 
  key_id = '82d609992f0d877e6a90630c310f6dd18914bdbdf77f350c38ae8a89122183e7' 
  AND (
    token = 'BkgxyZaKQEmymPApIgkdzOxCN6Jtln7HqMZ11zx+C6k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040