UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V39GLnE+uG3ViJ8lzrfedz4/IhP+iOhSdpNyTvy9M7w='
WHERE
key_id = '9a50119d944a96a4ed7160314c293774f1279fb1da35865bd365897284c1efbc'
AND (
token = 'V39GLnE+uG3ViJ8lzrfedz4/IhP+iOhSdpNyTvy9M7w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)