UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8CSSJiKq5Uo88B2YGkB4G6abii1SMyY/alldJIM5DuU='
WHERE
key_id = 'ec02c13c777cb17645bd901b3433293a4ac54a3d0767d49fc056a8b765eedcef'
AND (
token = '8CSSJiKq5Uo88B2YGkB4G6abii1SMyY/alldJIM5DuU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)