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