UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm8006x35+43/iHhfJBOG+C+DhIMHMMWUTyuDXLsT3W8='
WHERE
key_id = '47830f7a9f8feebc6b4864b9b8b33434f0043e0c3266d0a4499c4cb3375d1ab8'
AND (
token = 'm8006x35+43/iHhfJBOG+C+DhIMHMMWUTyuDXLsT3W8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)