UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6zGkRtIZ/ruTncYbx0BlwyoKCNJxc19soYyyj2RtRRY='
WHERE
key_id = 'a1f5fbd233ff7fac00e9f658642e1ae75d9c2323253fd4623f12aa71f5fd01ed'
AND (
token = '6zGkRtIZ/ruTncYbx0BlwyoKCNJxc19soYyyj2RtRRY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)