UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Hutx7tj64IQSDcu7pSGwvodD+GUGKyl5KS6fHpH7Ph4='
WHERE
key_id = 'b40aea4c929fed2197fb0103697df52eefd2bf75a880ec7f47b917dcd769149c'
AND (
token = 'Hutx7tj64IQSDcu7pSGwvodD+GUGKyl5KS6fHpH7Ph4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)