UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B/BLc5gpfxhWXxX5ke6sCODMiMLz9dT0V3nh1guWI0s=' 
WHERE 
  key_id = '9024bb51077f15c7a589005b936c325f012b7a259333a943ee510be09c8068da' 
  AND (
    token = 'B/BLc5gpfxhWXxX5ke6sCODMiMLz9dT0V3nh1guWI0s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046