UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7GCLyU5Xsmymwj1ietnk1YbKDnWaobuo9nynmeMACpA='
WHERE
key_id = 'a9c399fb9e4563f7452705c7e76f7d8870c88d702584c6da789ba8bf5bb89f03'
AND (
token = '7GCLyU5Xsmymwj1ietnk1YbKDnWaobuo9nynmeMACpA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)