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