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