UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NEJunSjtOncOUhjzONpjNhNCZe/SQecRfYKQ4EsTxNM='
WHERE
key_id = 'e1a4df031f6a84e832ffe6cce10a7782dc3207668b70405f6b20137a0f1a64aa'
AND (
token = 'NEJunSjtOncOUhjzONpjNhNCZe/SQecRfYKQ4EsTxNM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)