UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pt4aKAwcEI7qIxd91bRx7meUCcGlRUTCE9RU+5TwM3A='
WHERE
key_id = '24a327cabf4a6ab5374224dc3aa09dd7fef83712bfac3f6117d189413b072e1b'
AND (
token = 'pt4aKAwcEI7qIxd91bRx7meUCcGlRUTCE9RU+5TwM3A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)