UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hueMqhlPnRX73IWFdUuh3qkTJLNEkEB3aBoyp5yL/8I='
WHERE
key_id = '38d6329dcd6f196986df415ca4467963a8b227051743d1917eaec7e027313fda'
AND (
token = 'hueMqhlPnRX73IWFdUuh3qkTJLNEkEB3aBoyp5yL/8I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)