UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GlJcEr8IXmx/zdM1THpViSyyYcbFBC2RU+h+P2bJV84='
WHERE
key_id = 'c888582ca649591ddc49ebd7e3db1aa8eb8c13edb9db357b8a320edd36af003e'
AND (
token = 'GlJcEr8IXmx/zdM1THpViSyyYcbFBC2RU+h+P2bJV84='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)