UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZhnOIEusC4W8xk8na8tPBDlmS0/mT+W1EsoZGWkdiDc='
WHERE
key_id = 'b52786b62a2488078454c06af86fa993c7b91de6cc5a499e44e7e265ed27dd16'
AND (
token = 'ZhnOIEusC4W8xk8na8tPBDlmS0/mT+W1EsoZGWkdiDc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)