UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nHnWtW0LtIbqLzxsvQlcGG6Yg8Otr8yDJrKQ0KxBZ8Y='
WHERE
key_id = 'c6bced8d1897a7e9e86e2f2a9f0c1c08dd83e14be3082703cfde197c1e84ecaa'
AND (
token = 'nHnWtW0LtIbqLzxsvQlcGG6Yg8Otr8yDJrKQ0KxBZ8Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)