UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3X6PhzSKFhlKHZvfXQrUVsHBd0Q4otDQukMqUBVoSow='
WHERE
key_id = '0d3e20cd39c55bfdb85d001036edeca0e783c8dd93119d0ae2fdd492b7caffbc'
AND (
token = '3X6PhzSKFhlKHZvfXQrUVsHBd0Q4otDQukMqUBVoSow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)