UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gPv1K3a+zZ9VqFLsKMbpaKlyWM7nTuNTDcL4Pt7E5Eg='
WHERE
key_id = 'd7169c967d1cf9ae45d86614b11d8c042c938bd5e2e1d9bf97edcdd8150e1806'
AND (
token = 'gPv1K3a+zZ9VqFLsKMbpaKlyWM7nTuNTDcL4Pt7E5Eg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)