UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '40xZ+I8kor+UC09fOy0aWvRnJr6KzN9Jel3hRkS7khw='
WHERE
key_id = 'c65b67a30362daa8e969f0584f6c8dea7be40b7ff1eb5ebda406b5c007472f8f'
AND (
token = '40xZ+I8kor+UC09fOy0aWvRnJr6KzN9Jel3hRkS7khw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)