UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TmN9cIQLQwd25IVFlaOWmvgSnFlWFGsvPzQeigEATGE='
WHERE
key_id = 'f0e40ec5bc8bde224286a528346204a07836ed5178cea9d8f72e2dac818e19c8'
AND (
token = 'TmN9cIQLQwd25IVFlaOWmvgSnFlWFGsvPzQeigEATGE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)