UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K+uKfsFlgMjtTddBU0bARfoPuUdfA8oRmj6ZWOKSSgw='
WHERE
key_id = '048d2cbefa049605149ce01bb5d7bac5701a9dcf5ac772d9323c330df11a579c'
AND (
token = 'K+uKfsFlgMjtTddBU0bARfoPuUdfA8oRmj6ZWOKSSgw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)