UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oBHP1vw/wfM8kToFSd0WOE1Div+OJWyiiQ3BO4IiOdI='
WHERE
key_id = 'f00f05b17129f63f7e307b3c37d41eafe6e496a41b13734382ef73392d04b3cc'
AND (
token = 'oBHP1vw/wfM8kToFSd0WOE1Div+OJWyiiQ3BO4IiOdI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)